<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOCX预览</title>
    <style type="text/css">
        #container {
            border: 1px solid #666666;
        }
    </style>
</head>

<body>
    <input id="document" type="file" onchange="onGetFile(this)" accept=".docx" />
    <br>
    <div id="container"></div>
    <script src="./jszip.min.js"></script>
    <script src="./docx-preview.js"></script>
    <script>
        function onGetFile(el) {
            var file = el.files[0]
            var options = { inWrapper: false, ignoreWidth: true, ignoreHeight: true } // https://github.com/VolodymyrBaydalka/docxjs#api
            docx.renderAsync(file, document.getElementById("container"), null, options)
                .then(x => console.log("docx: finished"));
        }
    </script>
</body>

</html>